#pragma once
#include <iostream>
#include <ctime>
#include <cstdarg>
enum{
    Ddebug = 0,
    Info,
    Warning,
    Error,
    Fatal
};
std::string LeveltoString(int level)
{
    switch(level)
    {
        case Ddebug:
            return "Debug";
        case Info:
            return "InFo";
        case Warning:
            return "Waring";
        case Error:
            return "Error";
        case Fatal:
            return "Fatal";
        default:
            return "unknow";
            
    }
}

class Log
{
public:
    Log()
    {}
    void LogMessage(int level,const char* format,...)
    {
        char left[1024];
        va_list arg;
        va_start(arg,format);//...离可变参数最近的参数
        //arg 指向可变参数部分
        vsnprintf(left,sizeof(left),format,arg);
        va_end(arg);
        uint64_t current = time(nullptr);
        printf("[%s][%s]%s\n",LeveltoString(level).c_str(),left,std::to_string(current));
    }
    ~Log()
    {}
};